package com.edu.scau.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

@Entity
@Table(name = "shopping_cart")
public class ShoppingCart implements Serializable{
	@Id
	@ManyToOne(targetEntity = User.class)
	@Cascade(value = CascadeType.ALL)
	@JoinColumn(name = "user_id", referencedColumnName = "user_id")
	private User user;
	
	@Id
	@ManyToOne(targetEntity = Commodity.class)
	@Cascade(value = CascadeType.ALL)
	@JoinColumn(name = "commodity_id", referencedColumnName = "commodity_id")
	private Commodity commodity;
	
	@Column(name = "number")
	private int number;

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Commodity getCommodity() {
		return commodity;
	}

	public void setCommodity(Commodity commodity) {
		this.commodity = commodity;
	}

	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}
	
	
	
}
